package com.shop.admin.controller;

import com.shop.Result.LdbzResult;
import com.shop.admin.service.AdminSearchLeftAdService;
import com.shop.pojo.LdbzSearchLeftAd;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/searchL/service")
public class AdminSearchLeftAdController {

    private static final Logger logger = LoggerFactory.getLogger(AdminPictureController.class);

    @Autowired
    private AdminSearchLeftAdService adminSearchLeftAdService;

    @RequestMapping(value="/editSearchLeftAd/{id}" , method = RequestMethod.GET)
    public LdbzResult editSearchLeftAd(@PathVariable("id")long id , Model model) {
        return adminSearchLeftAdService.selectByKey(id);
    }

    @RequestMapping(value="/getSearchLeftAdPage" , method = RequestMethod.GET)
    public LdbzResult getSearchLeftAdPage(LdbzSearchLeftAd entity , int page , int limit) {
        return adminSearchLeftAdService.getSearchLeftAdPage(entity, page, limit);
    }

    @RequestMapping(value="/selectByKey/{id}" , method = RequestMethod.GET)
    public LdbzResult selectByKey(@PathVariable("id")long id) {
        return adminSearchLeftAdService.selectByKey(id);
    }

    @RequestMapping(value="/deleteByKey/{id}" , method = RequestMethod.GET)
    public LdbzResult deleteByKey(@PathVariable("id")String id) {
        return adminSearchLeftAdService.deleteByKey(id);
    }

    @RequestMapping(value="/insertByEntity" , method = RequestMethod.GET)
    public LdbzResult insertByEntity(LdbzSearchLeftAd entity) {
        return adminSearchLeftAdService.insertByEntity(entity);
    }

    @RequestMapping(value="/updateByKey" , method = RequestMethod.GET)
    public LdbzResult updateByKey(LdbzSearchLeftAd entity) {
        return adminSearchLeftAdService.updateByKey(entity);
    }
}
